package models;

import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import play.data.validation.Required;
import play.db.jpa.Model;

@Entity
public class Notification extends Model
{
    public enum Statuses {
        SHOW, NOTSHOW
		}
	
	public enum Types {
        Requestt, Handshakee, Offerr, Commentt
		}
	

    @Enumerated(EnumType.STRING)
    public Statuses status;
	
    @Enumerated(EnumType.STRING)
    public Types type;
	
    @ManyToOne
    public Request request;
    
    @ManyToOne
    public Offer offer;
    
    @ManyToOne
    public Handshake handshake;
    
    @ManyToOne
    public User user;	
   
    @ManyToOne
    public Comment comment;
	
    public String reason;
	
    public Notification(Request request, User user, Handshake handshake, String reason) {
	this.offer = null;
	this.comment = null;

	this.reason = reason;	
	this.handshake = handshake;
	this.request = request;
	this.user = user;
	this.status = Statuses.SHOW;
	this.type = Types.Requestt;
    }
	    
	public Notification(Offer offer, User user, Handshake handshake, String reason) {
	this.request = null;
	this.comment = null;

	this.reason = reason;	
	this.handshake = handshake;
	this.user = user;
	this.offer = offer;
	this.status = Statuses.SHOW;
	this.type = Types.Offerr;
    }
	    
	public Notification(Handshake handshake, User user, String reason) {
	this.request = null;
	this.offer = null;
	this.comment = null;

	this.reason = reason;	
	this.user = user;
	this.handshake = handshake;
	this.status = Statuses.SHOW;
	this.type = Types.Handshakee;
    }
	public Notification(Comment comment, User user, String reason) {
	this.request = null;
	this.offer = null;
	this.handshake = null;

	this.reason = reason;
	this.comment = comment;
	this.user = user;
	this.status = Statuses.SHOW;
	this.type = Types.Commentt;
    }

}
